Skip to content

header fastedge app#127

Merged
ruslanti merged 6 commits intomainfrom
feat/header_fastedge_app_id
May 6, 2026
Merged

header fastedge app#127
ruslanti merged 6 commits intomainfrom
feat/header_fastedge_app_id

Conversation

@ruslanti
Copy link
Copy Markdown
Collaborator

@ruslanti ruslanti commented May 6, 2026

No description provided.

ruslanti added 5 commits May 6, 2026 14:56
…lution logic

- Added support for `fastedge_app_id` header in app resolution, prioritizing it over `server_name`.
- Refactored `app_name_from_request` function to normalize hyphens in URL path and parse IDs from `fastedge_app_id`.
- Replaced hardcoded "server_name" string with a constant `SERVER_NAME_HEADER`.
- Improved tests to handle both new and existing app resolution scenarios.
… test cases

- Changed `hostname` method to accept `impl ToSmolStr`, improving flexibility.
- Updated tests to use the new `hostname` method and removed redundant `Server_name` header setup.
…ation

- Updated `Cargo.toml` to use the Rust 2024 edition for compatibility with upcoming language features.
- Simplified `FASTEDGE_APP_ID_HEADER` constant by removing unnecessary `'static` lifetime annotation.
- Combined nested conditions into cleaner `&& let` chains for improved readability.
- Removed redundant braces and streamlined header handling to reduce code complexity.
@ruslanti ruslanti self-assigned this May 6, 2026
Copilot AI review requested due to automatic review settings May 6, 2026 13:17
@ruslanti ruslanti added the enhancement New feature or request label May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes handling of the server_name header across crates and extends HTTP request routing to support resolving applications by numeric ID via a new fastedge_app_id header, with additional tracing instrumentation and related test updates.

Changes:

  • Introduce and adopt a shared SERVER_NAME_HEADER constant and adjust header propagation/derivation behavior.
  • Add fastedge_app_id request header support by extending app identification to AppName::{Name, Id} and routing via lookup_by_id.
  • Add tracing instrumentation and expand unit/integration tests around the updated routing logic.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Cargo.toml Bumps workspace Rust edition to 2024.
src/main.rs Uses shared SERVER_NAME_HEADER constant when auto-injecting headers.
src/executor.rs Import ordering only.
src/context.rs Import ordering only.
crates/runtime/src/util/stats.rs Import ordering only (tests module).
crates/runtime/src/util/metrics.rs Import ordering only.
crates/runtime/src/stub.rs Import ordering only.
crates/runtime/src/store.rs Import ordering only.
crates/runtime/src/registry.rs Import ordering only / restructured import grouping.
crates/runtime/src/lib.rs Import ordering only.
crates/http-service/src/state.rs Adds tracing::instrument to backend_request.
crates/http-service/src/lib.rs Adds AppName (name/id), fastedge_app_id parsing, lookup-by-id flow, and tests.
crates/http-service/src/executor/wasi_http.rs Changes how authority/Host are derived for WASI HTTP execution (now based on backend hostname).
crates/http-service/src/executor/http.rs Updates tests and router mock to support lookup-by-id; uses shared header constant.
crates/http-backend/src/lib.rs Adds SERVER_NAME_HEADER, adjusts FastEdge host propagation to use configured backend hostname, and updates tests.
Comments suppressed due to low confidence (1)

crates/http-service/src/lib.rs:586

  • to_str().unwrap() on server_name can panic on non-UTF8 header values, turning a bad request into a process crash. Prefer returning an error (e.g., to_str().context("server_name header is not valid UTF-8")?) so handle_request can map it to a 404/400 cleanly.
    match req.headers().get(SERVER_NAME_HEADER) {
        None => {}
        Some(h) => {
            let full_hostname = h.to_str().unwrap();
            match full_hostname.find('.') {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Cargo.toml
Comment thread crates/http-service/src/executor/wasi_http.rs Outdated
Comment thread crates/http-service/src/state.rs Outdated
@ruslanti ruslanti requested a review from qrdl May 6, 2026 13:48
@ruslanti ruslanti merged commit aa6882c into main May 6, 2026
4 of 6 checks passed
@ruslanti ruslanti deleted the feat/header_fastedge_app_id branch May 6, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants